package com.gaofeng.day11;

import java.util.Random;

/**
 * @author gaofeng
 * @date 2024-12-22 - 13:05
 */
public class demo06 {
    public static void main(String[] args) {
        // 打乱数组的顺序
        int[] arr = {1,2,3,4,5};
        // 获取随机索引
        Random random = new Random();


        for (int i = 0; i < arr.length; i++) {
            int index = random.nextInt(arr.length);
            int temp = arr[i];
            arr[i] = arr[index];
            arr[index] = temp;
        }
        for (int i = 0; i < arr.length; i++) {
            System.out.print(arr[i]);
        }
    }
}
